<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    ul,li{
      list-style: none;
    }
    li{
      display: inline-block;
      margin-right: 20px;
    }
    
    .tap{
      width: 300px;
      margin: 100px auto;
    }
    .tap div{
      display: none;
    }
    .tap .current{
      display: block;
    }
    .active{
      color: red;
      border-bottom: 1px solid red;
    }
  </style>
</head>
<body>
  <div id="app">
    <div class="tap">
      <ul>
        <li :key='item.id' @click='change(index)' :class='currentIndex==index? "active":""' v-for='(item,index) in list'>{{ item.title }}</li>
      </ul>
      <div :key='item.id' @click='change(index)' :class='currentIndex==index? "current":""' v-for='(item,index) in list'>{{ item.content }}</div>
    </div>
  </div>
  <script src="../js/vue.js"></script>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        currentIndex: this.index,
        list:[{
          id: 1,
          title: '商品介绍',
          content: '商品介绍'
        },{
          id: 2,
          title: '规格包装',
          content: '规格包装'
        },{
          id: 3,
          title: '售后保障',
          content: '售后保障'
        }]
      },
      methods:{
        change(index){
          this.currentIndex = index;
        }
      }
    })
  </script>
</body>
</html>